<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .container1,
    .container2,
    .container3 {
      width: 1200px;
      height: 600px;
    }
  </style>
</head>

<body>
  <!-- 2.定义一个具备宽高的DOM容器 -->
  <div class="container1"></div>
  <div class="container2"></div>
  <div class="container3"></div>
  <!-- 1.引入echarts.js文件 -->
  <script src="./js/echarts.min.js"></script>
  <script>
    // 3.初始化echarts
    const myEcharts1 = echarts.init(document.querySelector(".container1"))
    const myEcharts2 = echarts.init(document.querySelector(".container2"))
    const myEcharts3 = echarts.init(document.querySelector(".container3"))
    // 4.定义图片的配置项
    const option1 = {
      xAxis: {
        data: [
          "星期一",
          "星期二",
          "星期三",
          "星期四",
          "星期五",
          "星期六",
          "星期天",
        ]
      },
      yAxis: {
        // 是否显示坐标轴轴线
        axisLine: {
          show: true
        },
        // 是否显示坐标轴刻度
        axisTick: {
          show: true
        },
      },
      series: {
        type: 'bar',
        data: [22, 33, 18, 43, 29, 18, 30]
      },
    }

    const option2 = {
      xAxis: {
        data: [
          "星期一",
          "星期二",
          "星期三",
          "星期四",
          "星期五",
          "星期六",
          "星期天",
        ]
      },
      yAxis: {
        // 是否显示坐标轴轴线
        axisLine: {
          show: true
        },
        // 是否显示坐标轴刻度
        axisTick: {
          show: true
        },
      },
      series: {
        type: 'line',
        data: [22, 33, 18, 43, 29, 18, 30]
      },
    }

    const option3 = {
      series: {
        type: 'pie',
        data: [
          { name: '星期一', value: 22 },
          { name: '星期二', value: 33 },
          { name: '星期三', value: 18 },
          { name: '星期四', value: 43 },
          { name: '星期五', value: 29 },
          { name: '星期六', value: 18 },
          { name: '星期七', value: 30 },
        ]
      },
    }
    // 5.渲染图标
    myEcharts1.setOption(option1)
    myEcharts2.setOption(option2)
    myEcharts3.setOption(option3)

  </script>
</body>

</html>